﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Acoris.Document
{
    /// <summary>
    /// 
    /// </summary>
    public sealed class GeometrySegment : IContentSegment
    {
        internal IContentFormat m_format;
        internal int m_geometryCount;

        /// <summary>
        /// 
        /// </summary>
        public IContentFormat Format {
            get { return m_format; }
        }

        /// <summary>
        /// 
        /// </summary>
        public int Length {
            get { return m_geometryCount; }
        }        

        public void ApplyFormat(IContentFormat format)
        {
            
        }

        public void InsertRange(int offset, IContentSegment content)
        {
            
        }

        public void RemoveRange(int offset, int count)
        {
            
        }

        public void ReplaceRange(int offset, int count, IContentSegment content)
        {
            
        }

        public IContentSegment Split(int offset)
        {
            return null;
        }

        #region Override

        /// <summary>
        /// 获取与当前对象等价的字符串形式
        /// </summary>
        /// <returns>返回与当前对象等价的字符串形式</returns>
        public override string ToString()
        {
            return "Geometry";
        }

        /// <summary>
        /// 获取当前对象与指定对象之间的等价性
        /// </summary>
        /// <param name="obj">指定要比较的对象</param>
        /// <returns>如果两个对象之间等价则返回true，否则返回false</returns>
        public override bool Equals(object obj)
        {
            if (obj is GeometrySegment segment) {
                return segment.GetHashCode() == this.GetHashCode();
            }
            return false;
        }

        /// <summary>
        /// 获取当前对象的哈希值
        /// </summary>
        /// <returns>返回当前对象的哈希值</returns>
        public override int GetHashCode()
        {
            // TODO:
            return base.GetHashCode() ^ this.m_geometryCount.GetHashCode();
        }

        public void ClearFormat()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
